using UnityEngine;

public class ColorUtils : MonoBehaviour
{
	public static Color HexToColor(uint HexVal, float alpha = 1f)
	{
		float num = (float)(double)((HexVal >> 16) & 0xFF);
		float num2 = (float)(double)((HexVal >> 8) & 0xFF);
		float num3 = (float)(double)(HexVal & 0xFF);
		return new Color(num / 255f, num2 / 255f, num3 / 255f, alpha);
	}

	public static string ColorToHex(Color color)
	{
		return ColorUtility.ToHtmlStringRGB(color);
	}

	public static Color SetAlpha(Color color, float alpha = 1f)
	{
		return new Color(color.r, color.g, color.b, alpha);
	}

	public static Color SetAlpha(Color color, int alpha = 255)
	{
		return new Color(color.r, color.g, color.b, (float)alpha / 255f);
	}
}
